var a = getApp();

Page({
    data: {
        loading: !0,
        imageUrl: "",
        weixinProgramShareInfo: "",
        screenH: 1334,
        needUpdate: !1
    },
    onLoad: function(a) {
        this.loadData();
    },
    loadData: function() {
        var e = this, t = wx.getSystemInfoSync();
        this.setData({
            screenH: t.screenHeight
        }), console.log(t.screenHeight), a.network.post({
            url: a.url.generateScheduleCard,
            params: {
                width: t.screenWidth,
                height: t.screenHeight
            },
            before: function() {
                wx.showNavigationBarLoading();
            },
            success: function(t) {
                1 == t.data.result ? (wx.getImageInfo({
                    src: t.data.data.imageUrl,
                    success: function(a) {
                        console.log("eeee", a), e.setData({
                            loading: !1,
                            imageUrl: a.path
                        });
                    }
                }), e.setData({
                    weixinProgramShareInfo: t.data.data.weixinProgramShareInfo,
                    needUpdate: !1
                })) : a.util.showToast(t.data.message);
            },
            fail: function() {
                a.util.showToast("获取图片失败");
            },
            complete: function() {
                wx.hideNavigationBarLoading();
            }
        });
    },
    clickLocal: function(a) {
        var e = this;
        wx.saveImageToPhotosAlbum({
            filePath: e.data.imageUrl
        });
    },
    clickSetting: function(a) {
        wx.navigateTo({
            url: "/pages/schedule/scheduleCardSetting/scheduleCardSetting"
        });
    },
    onReady: function() {},
    onShow: function() {
        this.data.needUpdate && this.loadData();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        return {
            title: this.data.weixinProgramShareInfo.shareTitle,
            path: this.data.weixinProgramShareInfo.shareUrl,
            imageUrl: this.data.weixinProgramShareInfo.shareImage,
            success: function(a) {},
            fail: function(a) {}
        };
    }
});